<template>
  <el-dialog
    v-model="visible"
    width="417px"
    append-to-body
    :close-on-click-modal="false"
    :modal="false"
    :show-close="false"
    custom-class="add_temp save_tips"
  >
    <template #header>
      <div class="dialog_top">
        <img src="@/assets/images/icon/warn_icon.png" />
        <slot name="top"></slot>
      </div>
    </template>
    <div>
      <div class="tips_cont"><slot name="content"></slot></div>
    </div>
    <template #footer>
      <div class="dialog_btn">
        <slot name="button"></slot>
      </div>
    </template>
  </el-dialog>
</template>

<script setup lang="ts">
interface Props {
  showConfirm?: boolean
}

const props = withDefaults(defineProps<Props>(), {
  showConfirm: true,
})

const visible = defineModel<boolean>('visible', { default: false })
</script>

<style lang="scss" scoped>
:deep(.add_temp) {
  display: flex;
  flex-direction: column;
  margin: 0 !important;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.16);
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  .el-dialog__header {
    padding: 21px 17px 10px;
  }
  .dialog_btn {
    display: flex;
    justify-content: center;
  }
  .dialog_top {
    display: flex;
    align-items: center;
    line-height: 24px;
    img {
      width: 18px;
      height: 15px;
    }
    span {
      font-size: 16px;
      color: #000;
      margin-left: 5px;
    }
  }
  .tips_cont {
    font-size: 14px;
    color: #000;
    line-height: 21px;
  }
  .dialog_btn {
    display: flex;
    justify-content: flex-end;
    .el-button {
      border-radius: 6px;
      width: 76px;
      height: 32px;
      line-height: 32px;
      padding: 0;
      & + .el-button {
        margin-left: 14px;
      }
      &.el-button--default {
        background: none;
        border: 1px solid #e5e5e5;
        color: #383838;
      }
    }
  }
  .el-dialog__body {
    padding: 10px 45px 23px 40px;
  }
  .el-dialog__footer {
    padding-right: 15px;
    padding-bottom: 16px;
  }
}
</style>
